<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui"
                template="../templates/ui.xhtml">

    <ui:define name="content">

        <h1 class="title ui-widget-header ui-corner-all">AJAX - Status Standard</h1>
        <div class="entry">
            <p>Ajax Status also support standard JSF ajax calls.</p>

            <h:form>

                <p:panel id="panel" header="Ajax Status">

                    <p:messages id="msgs" />

                    <h:panelGrid columns="3" cellpadding="5">
                        <h:outputLabel for="firstname" value="Firstname: *" />
                        <p:inputText id="firstname" value="#{personBean.firstname}" required="true" label="Firstname">
                            <f:validateLength minimum="2" />
                        </p:inputText>
                        <p:message for="firstname" id="lblErrFirstName" />

                        <h:outputLabel for="surname" value="Surname: *" />
                        <p:inputText id="surname" value="#{personBean.surname}" required="true" label="Surname"/>
                        <p:message for="surname" id="lblErrSurname" />

                    </h:panelGrid>

                    <h:commandButton value="Submit" actionListener="#{personBean.savePerson}" id="btnGlobal">
                        <f:ajax execute="panel" render="panel" />
                    </h:commandButton>
                    
                </p:panel>

            </h:form>

            <h3>Source</h3>
            <p:tabView>
                <p:tab title="ajaxStatusStandard.xhtml">
                    <pre name="code" class="xml">
&lt;h:form&gt;

    &lt;p:panel id="panel" header="Ajax Status"&gt;

        &lt;p:messages id="msgs" /&gt;

        &lt;h:panelGrid columns="3" cellpadding="5"&gt;
            &lt;h:outputLabel for="firstname" value="Firstname: *" /&gt;
            &lt;p:inputText id="firstname" value="\#{personBean.firstname}" required="true" label="Firstname"&gt;
                &lt;f:validateLength minimum="2" /&gt;
            &lt;/p:inputText&gt;
            &lt;p:message for="firstname" id="lblErrFirstName" /&gt;

            &lt;h:outputLabel for="surname" value="Surname: *" /&gt;
            &lt;p:inputText id="surname" value="\#{personBean.surname}" required="true" label="Surname"/&gt;
            &lt;p:message for="surname" id="lblErrSurname" /&gt;

        &lt;/h:panelGrid&gt;

        &lt;h:commandButton value="Submit" actionListener="\#{personBean.savePerson}" id="btnGlobal"&gt;
            &lt;f:ajax execute="panel" render="panel" /&gt;
        &lt;/h:commandButton&gt;

    &lt;/p:panel&gt;

&lt;/h:form&gt;

&lt;p:ajaxStatus style="width:64px;height:64px;position:fixed;right:5px;bottom:5px"&gt;
    &lt;f:facet name="start"&gt;
        &lt;p:graphicImage value="/images/loading.gif" /&gt;
    &lt;/f:facet&gt;

    &lt;f:facet name="complete"&gt;
        &lt;h:outputText value="" /&gt;
    &lt;/f:facet&gt;
&lt;/p:ajaxStatus&gt;
                    </pre>
                </p:tab>

                <p:tab title="PersonBean.java">
                    <pre name="code" class="java">
package org.primefaces.examples.view;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;

public class PersonBean {

	private String firstname;
	
	private String surname;

	public String getFirstname() {
		return firstname;
	}
	public void setFirstname(String firstname) {
		this.firstname = firstname;
	}

	public String getSurname() {
		return surname;
	}
	public void setSurname(String surname) {
		this.surname = surname;
	}
	
	public void savePerson(ActionEvent actionEvent) {
		FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Welcome " + firstname + " " + surname + "!"));
	}
}
                    </pre>
                </p:tab>
            </p:tabView>


        </div>

    </ui:define>

</ui:composition>